﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynaPrecision
{
	public static class DynamicCastOperator
	{
		public static TResult Add<T1, T2, TResult>(T1 left, T2 right)
		{
			return (TResult)((dynamic)left + right);
		}
		public static TResult Substract<T1, T2, TResult>(T1 left, T2 right)
		{
			return (TResult)((dynamic)left - right);
		}
		public static TResult Multiply<T1, T2, TResult>(T1 left, T2 right)
		{
			return (TResult)((dynamic)left * right);
		}
		public static TResult Divide<T1, T2, TResult>(T1 left, T2 right)
		{
			return (TResult)((dynamic)left / right);
		}
		public static TResult CastToFunctor<T1, T2, TResult>(Func<T1, T2> functor, T1 input)
		{
			return (TResult)((dynamic)functor(input));
		}
		public static bool Equal<T1, T2>(T1 left, T2 right)
		{
			return (dynamic)left == right;
		}
	}
}
